package com.link.base.task;

import com.link.base.core.basic.config.xxljob.BaseLinkJobHandler;
import com.link.base.tencent.corpwx.externalcontact.service.UserBehaviorDataService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 企业微信获取联系客户统计数据
 *
 * @author 欧阳振强
 * @date 2020/02/06
 */
@JobHandler(value = "TaskGetUserBehaviorDataForWx")
@Component
public class TaskGetUserBehaviorDataForWx extends BaseLinkJobHandler {

    @Resource
    private UserBehaviorDataService userBehaviorDataService;

    @Override
    public ReturnT<String> execute(String params) throws Exception {
        try {
            XxlJobLogger.log("TaskGetUserBehaviorDataForWx");
            super.setLogin(params);
            userBehaviorDataService.generateUserBehaviorData();
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            XxlJobLogger.log(e.getMessage());
            return ReturnT.FAIL;
        }
    }
}
